/*
    Copyright 2006 Andrew Wilkinson <andrew@indiegigs.co.uk>

    This file is part of GL2x.

    GL2x is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    GL2x is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with GL2x; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

#define GLCLIENT
#include "gl_internal.h"

void glTexParameterf(GLenum target, GLenum pname, GLfloat param) {
    struct gltextureparams* texp;
    Fixed fparam = Fixed_fromFloat(param);

    if(current_state->begin) {
        current_state->error = GL_INVALID_OPERATION;
        return;
    }

    switch(target) {
    case GL_TEXTURE_1D:
        texp = &(current_state->tex1d);
    case GL_TEXTURE_2D:
        texp = &(current_state->tex2d);
    case GL_TEXTURE_3D:
        texp = &(current_state->tex3d);
    default:
        current_state->error = GL_INVALID_ENUM;
        return;
    }

    switch(pname) {
    case GL_TEXTURE_MIN_FILTER:
        texp->min_filter = fparam;
        break;
    case GL_TEXTURE_MAG_FILTER:
        texp->mag_filter = fparam;
        break;
    case GL_TEXTURE_MIN_LOD:
        texp->min_lod = fparam;
        break;
    case GL_TEXTURE_MAX_LOD:
        texp->max_lod = fparam;
        break;
    case GL_TEXTURE_BASE_LEVEL:
        texp->base_level = fparam;
        break;
    case GL_TEXTURE_MAX_LEVEL:
        texp->max_level = fparam;
        break;
    case GL_TEXTURE_WRAP_S:
        texp->wrap_s = fparam;
        break;
    case GL_TEXTURE_WRAP_T:
        texp->wrap_t = fparam;
        break;
    case GL_TEXTURE_WRAP_R:
        texp->wrap_r = fparam;
        break;
    case GL_TEXTURE_PRIORITY:
        texp->priority = fparam;
        break;
    default:
        current_state->error = GL_INVALID_ENUM;
        return;
    }

}

